From 444a92d6d833c0254d554e64e393bfc823d3555f Mon Sep 17 00:00:00 2001 From: Alexander Larsson Date: Thu, 13 Dec 2012 10:08:37 +0100 Subject: [PATCH] IconHelper: Avoid warnings for non-existing stock ids There are some registred stock ids like gtk-discards that have no icons, and you could also pass a non-registred stock id. Both of these means gtk_style_context_lookup_icon_set returns NULL, which causes a critical in gtk_icon_set_render_icon_pixbuf. We avoid this by just making these render as EMPTY. --- gtk/gtkiconhelper.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gtk/gtkiconhelper.c b/gtk/gtkiconhelper.c index 6f23914a8c..74eae6901d 100644 --- a/gtk/gtkiconhelper.c +++ b/gtk/gtkiconhelper.c @@ -325,7 +325,10 @@ _gtk_icon_helper_ensure_pixbuf (GtkIconHelper *self, case GTK_IMAGE_STOCK: icon_set = gtk_style_context_lookup_icon_set (context, self->priv->stock_id); - ensure_pixbuf_for_icon_set (self, context, icon_set); + if (icon_set != NULL) + ensure_pixbuf_for_icon_set (self, context, icon_set); + else + pixbuf = NULL; break; case GTK_IMAGE_ICON_SET: -- 2.30.2